package com.feilong.modules.web;


import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

public class TimePrinter{

    public static void main(String[] args) {
        DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        calendar.set(2021,0,30,21,26,0);
        Timer timer = new Timer();
        System.out.println(calendar.getTime());
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                LocalDateTime time = LocalDateTime.now();
                System.out.println("Current Local Time is "+ timeFormatter.format(time));
            }
        }, calendar.getTime());
    }

}
